package com.pactera.madp.daemon.quartz.task;

import com.pactera.madp.common.core.constant.SecurityConstants;
import com.pactera.madp.cp.api.feign.RemoteAsyncMsgTaskService;
import com.pactera.madp.daemon.quartz.constant.enums.MadpQuartzEnum;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 会话存档同步
 */
@Slf4j
@Component("asyncMsgTask")
@AllArgsConstructor
public class AsyncMsgTask {

    private RemoteAsyncMsgTaskService remoteAsyncMsgTaskService;

    /**
     * 同步会话数据
     * @return
     */
    public String onAsyncMsg() {
        remoteAsyncMsgTaskService.onAsyncMsg(SecurityConstants.FROM_IN);
        return MadpQuartzEnum.JOB_LOG_STATUS_SUCCESS.getType();
    }

    /**
     * 清除过期会话数据
     * @return
     */
    public String clearExpireMsg() {
        remoteAsyncMsgTaskService.clearExpireMsg(SecurityConstants.FROM_IN);
        return MadpQuartzEnum.JOB_LOG_STATUS_SUCCESS.getType();
    }

}
